package com.shujia.day05;

public class Demo09HWDog {
    public static void main(String[] args) {
        MyDog myDog = new MyDog("贵宾犬", 2, "心情好.", "甜心");
        myDog.run();
        myDog.bark();
    }
}

class MyDog{
    // 1.属性包括：品种，年龄，心情，名字；方法包括：叫，跑。
    private String varieties;
    private int age;
    private String mood;
    private String name;

    public MyDog(String varieties, int age, String mood, String name) {
        this.varieties = varieties;
        this.age = age;
        setMood(mood);
        this.name = name;
    }

    public String getVarieties() {
        return varieties;
    }

    public void setVarieties(String varieties) {
        this.varieties = varieties;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getMood() {
        return mood;
    }

    public void setMood(String mood) {
        if (mood.equals("心情好") || mood.equals("心情不好")){
            this.mood = mood;
        }else {
            System.out.println("输入信息错误，狗进行心情很好..");
            this.mood = "心情好";
        }
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void run(){
        String runType = "伤心的一动不动";
        if (this.mood.equals("心情好")){
            runType = "开心的围着主人转";
        }
        System.out.println("名字叫"+this.name+"的"+this.varieties+this.mood+","+runType);
    }

    public void bark(){
        String barkType = "伤心呜呜叫";
        if (this.mood.equals("心情好")){
            barkType = "汪汪叫";
        }
        System.out.println("名字叫"+this.name+"的"+this.varieties+this.mood+","+barkType);
    }

}